import os
import time


def create_app_path(app_num: int) -> str:
    """
    生成临时文件夹
    """
    date = time.strftime("%Y%m%d")
    data_path = rf'data/APP{app_num}/{date}'
    app_path = os.path.abspath(os.path.join(os.getcwd(), data_path))
    data_path = os.path.normpath(app_path)
    os.makedirs(data_path, exist_ok=True)
    return data_path


def create_custom_folder(app_name: str, folder_name: str) -> str:
    """
    生成临时文件夹
    """
    date = time.strftime("%Y%m%d")
    data_path = rf'data/{app_name}/{date}/{folder_name}'
    custom_path = os.path.abspath(os.path.join(os.getcwd(), data_path))
    data_path = os.path.normpath(custom_path)
    os.makedirs(data_path, exist_ok=True)
    return data_path


def get_data_path(app_num: int) -> tuple:
    path = create_app_path(app_num)
    form_path = create_custom_folder(app_num, "png")
    json_path = create_custom_folder(app_num, "json")
    xlsx_path = create_custom_folder(app_num, "xlsx")
    return path, form_path, json_path,xlsx_path


if __name__ == '__main__':
    create_app_path(1)
